<%--
  Created by IntelliJ IDEA.
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<html>
<head>
    <link href="../assets/vendor/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="../assets/vendor/bootstrap/bootstrap-icons.css" rel="stylesheet" type="text/css"/>
    <link href="../assets/css/my.css" rel="stylesheet" type="text/css"/>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="../assets/vendor/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="../assets/vendor/bootstrap/bootstrap.bundle.min.js"></script>
    <title>${res.data.resource.title}</title>
    <link rel="icon" href="../userConfig/favicon.png">
    <style>

        #block-resource img {
            display: block;
            max-width: 100%;
            height: auto;
        }

        #logo {
            width: 266px !important;
            position: relative;
            top: -5px;
            left: -19px;
        }

        @media screen and (max-width: 576px) {
            #block-resource {
                /*margin-right: 15px !important;*/
                /*margin-left: 15px !important;*/
                width: calc(100vw - 30px) !important;
            }

            #logo {
                left: 0;
            }
        }

    </style>
</head>
<body style="background-color: #f2f2f2">
<div style="position: fixed;top: 0;left: 0;width: 100%;height:80px;display:flex;align-items:center;background: #f2f2f2;z-index: 99">
    <div class="container">
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link text-primary" href="./">
                    <img src="../userConfig/logo.png" id="logo" class="rounded float-left logo">
                    <div class="text-center mt-2" style="color: dimgrey"></div>
                </a>
            </li>
        </ul>
    </div>
</div>


<%--col-lg-11 col-md-11 col-sm-11 col-xs-11--%>
<div class="container  mt-2 mb-2 " style="padding: 75px 15px 15px" id="block-resource">

    <div class="mt-2 p-3" style="background-color: #fff;">
        <div class="container mt-3 ">
            <h2 class="col-8"><strong style="color: #16181b">${res.data.resource.title}</strong></h2>
            <div class="col-8" style="color: #818182">
                标签：${fn:replace(res.data.resource.labelName, ',', '&nbsp;/&nbsp;')}</div>
            <div class="col-8" style="color: #818182">作者：${res.data.user}</div>
            <div class="col-8" style="color: #818182" id="time_label">
                时间：${fn:substring(res.data.resource.editTime, 0, 10)}&nbsp;${fn:substring(res.data.resource.editTime, 11, 16)}</div>
        </div>
        <hr/>
        <div class="container mt-3 mb-5" style=" padding-left: 26px;">
            <text>${data}</text>
        </div>
        <c:if test="${isFile}">
            <div class="resource-post-box resource-post-attach" style=" padding-left: 26px;">
                <div class="font-text-darkgray">附件</div>
                <c:forEach items="${fileMapS}" var="fileMap">
                <div id="file-list">
                    <div id="atta0" style="color: darkgray" class="mnt-7 font-text">
                        <a href="${fileMap.value}&name=${fileMap.key}">
                                ${fileMap.key}
                        </a>&nbsp;&nbsp;&nbsp;
                    </div>
                    </c:forEach>
                </div>
            </div>
        </c:if>
    </div>
</div>

<div class="container mt-2 mb-2">
        <div style="margin-left: 0px; display: flex; align-items: center">

            <a onclick="window.location.href = 'http://<%= request.getServerName()+":"+request.getServerPort()%>'" href="javascript:void(0)">首页</a>
            |
            <a id="goDetail" href="javascript:void(0)" target="_blank" >去知了查看</a>
        </div>
</div>

<footer class="footer-default">
        <div class="text-center">Copyright © All Right Reserved by <a href="http://www.free4inno.com/" target="_blank">自邮之翼</a></div>
</footer>

</body>
<script>

    window.onload = function () {
        document.getElementById("goDetail").setAttribute("href", 'http://zhi.free4inno.com/resource' + window.location.href.substring(window.location.href.lastIndexOf('/')));
    }

    // let baseUrl= 'http://localhost:9988/'
    function change_time(timestamp) {
        var time_lable = document.getElementById("time_label");
        time_lable.innerHTML = happenTimeFun()
        return happenTimeFun(timestamp)
    }

    function happenTimeFun(num) {//时间戳数据处理
        let date = new Date(num);
        //时间戳为10位需*1000，时间戳为13位的话不需乘1000
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;//月补0
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;//天补0
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;//小时补0
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;//分钟补0
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;//秒补0
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
    }
</script>
</html>


